package com.jetpackmvp;

import android.os.Bundle;
import android.os.SystemClock;
import android.widget.Toast;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

/**
 * @author: GY.LEE
 * @date: 2019-06-05
 */
public class SecondActivity extends AppCompatActivity {

    private static final String TAG = "SecondActivity";

    private static class CustomRunnable implements Runnable {

        @Override
        public void run() {
            SystemClock.sleep(20000);
        }
    }

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main2);

        findViewById(R.id.button).setOnClickListener(v -> {
//            CustomRunnable runnable = new CustomRunnable();
            Runnable runnable = new Runnable() {
                @Override
                public void run() {
                    SystemClock.sleep(20000);

                    Toast.makeText(SecondActivity.this, "", Toast.LENGTH_SHORT).show();

                }
            };
            new Thread(runnable).start();
        });
    }
}
